home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ABUSESRC.ZIP / AbuseSrc / imlib / include / filter.hpp < prev    next >
C/C++ Source or Header  |  1996-04-11  |  1KB  |  46 lines

  1. #ifndef _FILTER_HPP
  2. #define _FILTER_HPP
  3. #include "image.hpp"
  4. #include "palette.hpp"
  5. #include "specs.hpp"
  6. #include "jmalloc.hpp"
  7.  
  8. class filter
  9. {
  10.   unsigned char *fdat;
  11.   int nc;
  12. public :
  13.   filter(int colors=256);
  14.   filter(palette *from, palette *to);     // creates a conversion filter from one palette to another
  15.   void set(int color_num, char change_to);
  16.   unsigned char get_mapping(int color_num) { return fdat[color_num]; }
  17.   void apply(image *im);
  18.   void max_threshold(int minv, char blank=0);
  19.   void min_threshold(int maxv, char blank=0);
  20.   void put_image(image *screen, image *im, short x, short y, char transparent=0);
  21.   void clear();
  22.   ~filter() { jfree(fdat); }
  23. } ;
  24.  
  25. class color_filter
  26. {
  27.   unsigned char *color_table;
  28. public:
  29.   int size();
  30.   int write(bFILE *fp);
  31.   color_filter(spec_entry *e, bFILE *fp);
  32.   color_filter(palette *pal, int color_bits=6, void (*stat_fun)(int)=NULL);
  33.   unsigned char lookup_color(int r, int g, int b) 
  34.    { return color_table[r*32*32+g*32+b]; }
  35.   unsigned char *table() { return color_table; }
  36.   int total_colors() { return 32; }
  37.   unsigned char *get_table() { return color_table; }
  38.   ~color_filter() { jfree(color_table); }
  39. } ;
  40.  
  41. #endif
  42.  
  43.  
  44.  
  45.  
  46.